import React from 'react'
import { getCookies,removeCookies } from '../../utils/cookies'
import { Button,Popconfirm, message } from 'antd'
import { history,connect } from 'umi'
const text = '您确定退出登录?';

function confirm() {
    message.info('成功退出登录.');
    // console.log(history);
    removeCookies('loginState')
    removeCookies('adminname')
    removeCookies('role')
    removeCookies('token')
    history.push('/login')
}
export interface IRightHeaderProps {
}

export const RightHeader = (props: IRightHeaderProps) => {

    return (
        <div>
      您当前登录的账户为：{
        getCookies('adminname')
      }
      <Popconfirm placement="leftTop" title={text} onConfirm={confirm} okText="Yes" cancelText="No">
        <Button type="ghost" danger>退出</Button>
      </Popconfirm>
    </div>
    )
}

// export default connect(state => {
//     return {
//       adminname: state.login.adminname
//     }
//   })(RightHeader)
